#include<fstream>
#include<iostream>
#include<string>
#include<sstream>
#include<map>
#include<set>
#include<vector>
using std::endl;
using std::cout;
using std::ifstream;
using std::string;
using std::map;
using std::istringstream;
using std::set;
using std::vector;
using std::ostringstream;


//用两个指针进行比较
int test1(const string &s1,const string &s2){
    auto it = s1.begin();  //记录hit
    auto it2 = s2.begin(); //记录hot
    int size = 0;
    while(it != s1.end() && it2 != s2.end()){
        if(*it == *it2){
            ++size;
        }
        //cout<<"it ++"<<endl;
        ++it;
        ++it2;
        
    }
    return size;
}
bool isInArr(string&end,string *arr,int length){
    for(int i = 0;i <length;i++){
        if(arr[i]==end){
            return true;
        }
    }
    return false;
}
// begin end 都是目标数组 arr 字符串 length数组长度
void connectWord(string& begin,string& end,string *arr,int length){
     int idx=0;
     if(!isInArr(end,arr,length)){
        cout<<"不存在"<<endl;
        return;
     }
     for(int i = 0;i<length;i++){
        cout<<begin.c_str()<<endl;
        int size = test1(begin,arr[i]);
        //cout<<size<<endl;
        if(size >= begin.size()-1 && begin.compare(end)!=0 && length){
            cout<<"idx++"<<endl;
            ++idx;
            cout<<idx<<endl;
            begin = arr[i]; 
            //i++;错误 因为这里i++会跳过下一个，我在这里犯错了
            //cout<<begin.c_str()<<endl;
        }
     }
    cout<<"idx: "<<idx<<endl;
}

//找到第一个 和自己比较 size最大的


void test3(){
    string arr[]={"hot","dot","log","dog","cog"};
    string end = "cog";
    if(isInArr(end,arr,5)){
        cout<<"is in"<<endl;
    }
}
void test0(){

    string arr[]={"hot","dot","log","dog","cog"};
    string s1 = "hit";
    int size = test1(s1,arr[0]);

    if(size >= s1.size()-1){
        s1 = arr[0];
    }
    cout<<"s1: "<<s1.c_str()<<endl;
    cout<<"s2: "<<arr[0].c_str()<<endl;
}
int main(void){
    vector<int> num={1,2,3,5,6,7,8,9};
    num.erase(num.begin()+2);
    for(auto &ele : num){
        cout<<ele<<" ";
    }
    cout<<endl;
}
